<template>
    <div>
      <el-scrollbar class="app-container-scroll-bar">
				<listTpml :data="pageData" @onCommand="handleCommand" ref="listTpml"  ></listTpml>
      </el-scrollbar>

        	<!--弹窗内容 start-->
			<div class="app-output-window">
				<addCKDialog ref="addJQDialog"  @addSucess="refresh"></addCKDialog>
			</div>

    </div>
</template>



<script>
import listTpml from "@/view/components/listTmpl";
import addCKDialog from "@/view/components/dialog/addCKDialog";

export default {
  components: {
    listTpml,
    addCKDialog
  },
  data() {
    return {
      pageData: {
        pageTitle: "容器",
        filterOption: [
          {
            label: "仓库名", // label名
            paramsName: "name", // 出参name值
            defaultValue: "", // 出参默认值
            componentsName: "nameInput" ,// 组件名
          }
        ],
        // 列表table 设置
        listOption: {
          // 列表上部btn组
          listBtns: [
            {
              label: "添加仓库",
              iconfont: "icon-folder-add",
              commandName: "addCK"
            }
          ],
          // 列表api
          listApi: {
            url: "/appcloud-data/api/template/list",
            type: "POST",
            params: {
              templateType: ""
            }
          },
          // 表头设置
          header: [
            {
              label: "仓库名",
              width: "",
              propName: "name",
              align: "center"
            },
            {
              label: "模板数",
              width: "",
              align: "center",
              propName: "appType"
            },
            {
              label: "创建者",
              width: "",
              align: "center",
              propName: "appVersion"
            },
            {
              label: "创建时间",
              width: "",
              align: "center",
              propName: "deployType"
            },
            {
              label: "备注",
              width: "",
              align: "center",
              propName: "status"
            },
            {
              label: "操作",
              width: "290",
              align: "center",
              btns: [{label: "删除",commandName: "deleteCK"}],
              btnGroups: []
            }
          ]
        }
      }
    };
  },
  methods:{
        handleCommand(command,row,index){
            if(command&&this[command]){
                this[command](row,index);
            }
        },
        refresh(){
			this.$refs.listTpml.search();
        },
        // 添加仓库
        addCK(row,index){
           this.$refs.addJQDialog.open();
			console.log("添加集群 addJQ", row,index );
        },
        // 删除仓库
        deleteCK(row,index){
           this.$confirm("确定删除该操作?", "提示", {
	        confirmButtonText: "确定",
	        cancelButtonText: "取消",
	        type: "warning"
	        }).then(()=>{
                接口({id:row.id}).then(ret=>{
                    if(ret&&ret.code == 0){
                        this.$message({message: "删除成功",type: "success"})
	            this.refresh();
                    }
                })
            })
        }

  }
};
</script>